package com.ruoyi.procured.mapper;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.procured.domain.ProcuredPlan;
import com.ruoyi.procured.domain.ProcuredProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.procured.domain.TbProcuredProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author Admin
* @description 针对表【tb_procured_product】的数据库操作Mapper
* @createDate 2024-10-01 16:35:01
* @Entity com.ruoyi.procured.domain.ProcuredProduct
*/
@Mapper
public interface ProcuredProductMapper extends BaseMapper<ProcuredProduct> {

    //清除已转数量
    int  resetProcuredProductByPlanId(Long planId);

	ProcuredPlan getPlanProducts(@Param("planId") Long planId);

	List<ProcuredProduct> selectByPlanId(@Param("list") List<Long> prductIds,@Param("planId") Long planId);

	List<ProcuredProduct> selectListProcuredProduct(@Param("planId") Long planId);

	/**
	 * 禁用采购计划下对应对的产品
	 * @param productId
	 * @param planId
	 * @return
	 */
	int disabledProduct(@Param("productId") Long productId,@Param("planId") Long planId);

	/**
	 * 根据采购商品id修改对应的采购数量和可转数量
	 * @param id
	 * @param remainingCount
	 * @return
	 */
	int updateProcuredProduct(@Param("id") Integer id,@Param("remainingCount") int remainingCount);

	/**
	 * 批量更新数量
	 */
	int batchUpdateNumbers(@Param("list") List<ProcuredProduct> updateList);

	/**
	 * 根据id更新是否全部退货状态
	 * @param id
	 * @return
	 */
	int updateReturnCompletedStatus(@Param("id") Integer id);
}




